local obrsword_power = Class(function(self, inst)
    self.inst = inst

    --官方的关于人物net的部分其实都放到了 player_classified.lua 里面 不过mod偷懒的话可以直接写 只是不太正规而已

    self.current_obrsword_power = net_ushortint(inst.GUID, "obrsword_power.current", "obrsword_powerdirty") --第三个是事件名字 注意这个和界面监听的是同一个名字
    self.max_obrsword_power = net_ushortint(inst.GUID, "obrsword_power.max", "obrsword_powerdirty")
    
    self.inst:DoTaskInTime(0, function()
        self.inst:ListenForEvent("obrsword_powerdirty", function()
            self.inst:PushEvent("obrsword_powerdelta", self:GetPercent())
        end)
        self.inst:PushEvent("obrsword_powerdelta", self:GetPercent())
    end)

    self.current_obrsword_power:set(0)
    self.max_obrsword_power:set(100)
end)

function obrsword_power:SetCurrent(current)
    if self.current_obrsword_power ~= nil then
        self.current_obrsword_power:set(current)
    end
end

function obrsword_power:SetMax(max)
    if self.max_obrsword_power ~= nil then
        self.max_obrsword_power:set(max)
    end
end

function obrsword_power:Max()
    if self.inst.components.obrsword_power ~= nil then
        return self.inst.components.obrsword_power.max
    elseif self.max_obrsword_power ~= nil then
        return self.max_obrsword_power:value()
    else
        return 6666
    end
end

function obrsword_power:GetPercent()
    if self.inst.components.obrsword_power ~= nil then
        return self.inst.components.obrsword_power:GetPercent()
    elseif self.current_obrsword_power ~= nil and self.max_obrsword_power ~= nil then
        return self.current_obrsword_power:value() / self.max_obrsword_power:value()
    else
        return 1
    end
end

--别的方法不想写了有需要的自己补充吧

return obrsword_power